package org.liux.android.game.jumpgame.character;

public class TriangleRight extends Shape {
	public static final int STATE_1 = 0;
	public static final int STATE_2 = 1;
	
	/**      STATE_1                              STATE_2
	 *       
	 *       #                                              
	 *       #  #                                              #  #
	 *           #                                          #  #
	 */
	@Override
	public void change(Coordinate c) {
		int x = c.x;
		int y = c.y;
		
		if (mShapeList.size() > 0) {
			mShapeList.clear();
		}
		
		if(mState == STATE_1){
			mShapeList.add(new Coordinate(x+1, y+1));
			mShapeList.add(new Coordinate(x, y+1));
			mShapeList.add(new Coordinate(x, y+2));
			mShapeList.add(new Coordinate(x-1, y+2));
			mOldState = mState;
			mState=STATE_2;
			return;
		}
		if(mState == STATE_2){
			mShapeList.add(new Coordinate(x-1, y-1));
			mShapeList.add(new Coordinate(x-1, y));
			mShapeList.add(new Coordinate(x, y));
			mShapeList.add(new Coordinate(x, y+1));
			mOldState = mState;
			mState=STATE_1;
			return;
		}

	}
	@Override
	public void initCoord() {
		mShapeList.add(new Coordinate(mMidWidth, 0));
		mShapeList.add(new Coordinate(mMidWidth, 1));
		mShapeList.add(new Coordinate(mMidWidth+1, 1));
		mShapeList.add(new Coordinate(mMidWidth+1, 2));

	}


}
